﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Blade.IO;

namespace Blade.Metadata.PeLoader {
	sealed class PeSectionHeader {
		public PeSectionHeader(BinaryReader reader) {
			this.Name = reader.ReadString(8, Encoding.ASCII);
			this.VirtualSize = reader.ReadUInt32();
			this.VirtualAddress = reader.ReadUInt32();
			this.SizeOfRawData = reader.ReadUInt32();
			this.OffsetToRawData = reader.ReadUInt32();
			this.RVAToRelocations = reader.ReadUInt32();
			this.RVAToLineNumbers = reader.ReadUInt32();
			this.NumberOfRelocations = reader.ReadUInt16();
			this.NumberOfLineNumbers = reader.ReadUInt16();
			this.Characteristics = reader.ReadUInt32();
		}

		public readonly string Name;
		public readonly uint VirtualSize;
		public readonly uint VirtualAddress;
		public readonly uint SizeOfRawData;
		public readonly uint OffsetToRawData;
		public readonly uint RVAToRelocations;
		public readonly uint RVAToLineNumbers; // == 0
		public readonly ushort NumberOfRelocations;
		public readonly ushort NumberOfLineNumbers; // == 0
		public readonly uint Characteristics;
	}
}
